/**
 * @author deming_su@163.com
 * @time 2022-04-12 14PM
 * @description 定义购物车的数据接口
 */
 import Ajax from './Ajax'

 /**
  * 往购物车添加商品
  * @param {{userId: string, price: number, id: string, time: date, count: 1, name: string, detailaddress: string, bgUrl: string}} data 购物车添加参数
  * @returns 
  */
function addCartApi(data) {
    return Ajax({
        url: '/cart/add',
        data
    })
}

/**
 * 获取购物车信息
 * @param {string} userId 用户编码
 * @returns 
 */
function cartListApi(userId) {
    return Ajax({
        url: '/cart/' + userId,
        method: 'GET'
    })
}


function addApi(data) {
    return Ajax({
        url: '/cart/add',
        data
    })
}
function DeleteApi(data) {
    return Ajax({
        url: '/cart/delete',
        method: 'DELETE',
        data
    })
}

function DeApi(data) {
    return Ajax({
        url: '/cart/modify',
        data
    })
}

export {
    addApi,
    cartListApi,
    DeleteApi,
    DeApi 
}